package com.yonyou.pmclouds.safetypatrol.process;

import com.yonyou.pmclouds.basecom.bp.processor.MultiProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.safetypatrol.entity.SafetypatrolDetailVO;
import com.yonyou.pmclouds.safetypatrol.mapper.SafetypatrolDetailMapper;


public class SafetypatrolDetailUpdateCheckProcess implements MultiProcessor<SafetypatrolDetailVO> {

    private SafetypatrolDetailMapper detailMapper;

    public SafetypatrolDetailUpdateCheckProcess(SafetypatrolDetailMapper detailMapper) {
        this.detailMapper = detailMapper;
    }


    @Override
    public void process(SafetypatrolDetailVO[] vos, SafetypatrolDetailVO[] origs) throws BusinessException {
        if (vos!=null){
            for (SafetypatrolDetailVO vo : vos) {
                Integer count=  detailMapper.checkDetailRepeat(vo);
                if (count!=null && count>0){
                    throw new BusinessException("该检查项名称重复, BuziExCodeConst.CODE_NAME_BEEN_USED");
                }
            }
            }

    }
}
